<?php
/*
 * 关闭直播
*/
namespace App\Validation;

use Phalcon\Validation\Validator\PresenceOf;
use Phalcon\Validation\Validator\Numericality;

class LiveCloseValidation extends BaseValidation
{
    public function initialize()
    {

		$this->add(
			"host_id",
			new Numericality(
				  [
					  "message" => ":field is not numeric",
					  "allowEmpty" => true,
				  ]
			)
		);

		
    }
	
	//验证之前
	public function beforeValidation($data, $entity, $messages)
    {
        $data->host_id = property_exists($data,'host_id') ? $data->host_id : 0;
        return true;
    }
		
	
}